export const mixin={
	data() {
	    return { 	
			
		}
    },
	onLoad() {
		
	},
	methods: {
		sendImage() {
			uni.chooseImage({
				count :1,
				success :(res) => {
		
					console.log('resImg',res);
					this.asyncUpload(res.tempFilePaths[0],'image');
					
					
				}
			});
		},
		asyncUpload(imgUrl,type,resInfo) {
			console.log('开始上传',imgUrl,this.imageUploadUrl);
			uni.uploadFile({
				url:this.imageUploadUrl,
				filePath: imgUrl,
				fileType:type,
				name: 'file',
				success: (uploadFileRes) => {
					if (uploadFileRes.statusCode == 200) {
						
						let res = JSON.parse(uploadFileRes.data);
						// console.log("上传多张：",res)
						/*注意 如果返回的结果字段不一样，请在这里做修改[res.code]*/
						if (res.code === 0 || res.code === '0') {
							//成功情况下
							console.log('成功1',res);
							
						  if (type == 'image') {
						  	 this.customImageMessage(res.message);
						  } else if(type == 'audio'){
						  	 this.customAudioMessage(res.message,resInfo);
						  }	
						 	
						 
						  
							
						} else {
							
							uni.showToast({
								icon:'none',
								title:'上传失败，请重新尝试'
							},1500)
						}
					
					} else {
						
						console.log('成功2',uploadFileRes);
					}
				},
				fail: (e) => {
					console.log('errorwe',e);
					uni.showToast({
						icon:'none',
						title:'上传失败，请重新尝试'
					},1500)
				}
			});
			
		},
	}
}